import Vue from 'vue'
import Router from 'vue-router'
import insured from '@/components/insured'
import login from '@/components/login'
import home from '@/components/home'
import policy from '@/components/policy'
import dange from '@/components/dange'
import settlement from '@/components/settlement'
import prospectDamages from '@/components/prospectDamages'
Vue.use(Router)
//获取原型对象上的push函数
const originalPush = Router.prototype.push
//修改原型对象中的push方法
Router.prototype.push = function push(location) {
	return originalPush.call(this, location).catch(err => err)
}

export default new Router({
	routes: [{
			path: '/',
			name: 'login',
			redirect: 'login'
		},
		{
			path: '/login',
			name: 'login',
			component: login
		},

		{
			path: '/home',
			name: 'home',
			component: home,
			children: [{
				path: '/home/insured',
				name: 'insured',
				component: insured
			},
			{
				path: '/home/policy',
				name: 'policy',
				component: policy
			},
			{
				path: '/home/dange',
				name: 'dange',
				component: dange
			}, {
				path: '/home/settlement',
				name: 'settlement',
				component: settlement
			},{
				path: '/home/prospectDamages',
				name: 'prospectDamages',
				component: prospectDamages
			}]
		} ,{
			path: '/settlement',
			name: 'settlement',
			component: settlement
		}
	]
})
